//
//  PlistFile.h
//  YYPaas
//
//  Created by 余意 on 2018/6/26.
//  Copyright © 2018年 余意. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface PlistFile : NSObject

#pragma mark - 获取plist文件内容（字典）
+ (NSMutableDictionary *)readDictionaryPlistForKey:(NSSearchPathDirectory)searchPathDirectory WitFile:(NSString *)fileName;

#pragma mark - 获取plist文件内容（数组）
+ (NSMutableArray *)readArrayPlistForKey:(NSSearchPathDirectory)searchPathDirectory WithFile:(NSString *)filename;

#pragma mark - 获取document目录下文件路径
+ (NSString *)documentFilePathWithFile:(NSString *)filename;

#pragma mark - 获取library目录下文件路径
+ (NSString *)libraryFilePathWithFile:(NSString *)filename;

#pragma mark - 判断文件夹是否存在
+ (BOOL)fileExistsAtPath:(NSString *)filePath;

#pragma mark - 删除文件夹
- (void)deteleWithFile:(NSString *)filePath;

#pragma mark - 创建文件夹
+ (BOOL)creatDirectoryIfNotExistsAtPath:(NSString *)path;

#pragma mark - 二进制数据写入文件
+ (NSString *)writeToFile:(NSData *)data WithFileName:(NSString *)filename;

#pragma mark - 将资源文件的数据库写入沙盒中
+ (void)copyDatabaseIfNeededWithFile:(NSString *)fileName WithFileType:(NSString *)fileType SearchPathDirectory:(NSSearchPathDirectory)searchPathDirectory;

#pragma mark - 将资源文件的数据库写入沙盒
+ (void)copyDatabaseIfNeededWithFile:(NSString *)fileName SearchPathDirectory:(NSSearchPathDirectory)searchPathDirectory;

#pragma mark - 创建或向已存在的Plist文件写数据（数组）
+ (void)updatePlist:(NSSearchPathDirectory)searchPathDirectory WithFile:(NSString *)filename WithArray:(NSArray *)infoArray;

#pragma mark - 创建或向已存在的Plist文件写数据（字典）
+ (void)updatePlist:(NSSearchPathDirectory)searchPathDirectory WithFile:(NSString *)filename WithDictionary:(NSDictionary *)infoDict;

#pragma mark - 更新Plist文件（根目录文件为NSDictionary）一级目录下的某一个字段的内容
+ (void)updatePlist:(NSSearchPathDirectory)searchPathDirectory WithFile:(NSString *)filename WithKey:(NSString *)key WithValue:(id)value;

#pragma mark - 获取Plist文件（根目录为NSDictionary）的一级目录下某个字段
+ (NSString *)readPlistForKey:(NSSearchPathDirectory)searchPathDirectory WithFile:(NSString *)filename WithKey:(NSString *)key;

@end
